
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      <link rel="icon" href="../../../../static/images/favicon.png">
      <meta name="generator" content="mkdocs-1.3.0, mkdocs-material-8.2.8">
    
    
      
        <title>快速部署之 cmak / kafka-manager - WL4G DOCS</title>
      
    
    
      <link rel="stylesheet" href="../../../../assets/stylesheets/main.644de097.min.css">
      
        
        <link rel="stylesheet" href="../../../../assets/stylesheets/palette.e6a45f82.min.css">
        
      
    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
      <link rel="stylesheet" href="../../../../static/css/util.css">
    
    <script>__md_scope=new URL("../../../..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      

    
    
  </head>
  
  
    
    
      
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent="">
  
    
    
      <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#cmak-kafka-manager" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
      <div data-md-component="outdated" hidden>
        <aside class="md-banner md-banner--warning">
          
        </aside>
      </div>
    
    
      

<header class="md-header" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../../../.." title="WL4G DOCS" class="md-header__button md-logo" aria-label="WL4G DOCS" data-md-component="logo">
      
  <img src="../../../../static/images/mylogo.jpeg" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            WL4G DOCS
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              快速部署之 cmak / kafka-manager
            
          </span>
        </div>
      </div>
    </div>
    
      <form class="md-header__option" data-md-component="palette">
        
          
          
          <input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to dark mode"  type="radio" name="__palette" id="__palette_1">
          
            <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
            </label>
          
        
          
          
          <input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="" data-md-color-accent=""  aria-label="Switch to light mode"  type="radio" name="__palette" id="__palette_2">
          
            <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3z"/></svg>
            </label>
          
        
      </form>
    
    
      <div class="md-header__option">
        <div class="md-select">
          
          <button class="md-header__button md-icon" aria-label="Select language">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m12.87 15.07-2.54-2.51.03-.03A17.52 17.52 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04M18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12m-2.62 7 1.62-4.33L19.12 17h-3.24z"/></svg>
          </button>
          <div class="md-select__inner">
            <ul class="md-select__list">
              
                <li class="md-select__item">
                  <a href="/en/" hreflang="en" class="md-select__link">
                    English
                  </a>
                </li>
                
                <li class="md-select__item">
                  <a href="/zh/" hreflang="zh" class="md-select__link">
                    简体中文
                  </a>
                </li>
                
            </ul>
          </div>
        </div>
      </div>
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
        </button>
      </nav>
      
        <div class="md-search__suggest" data-md-component="search-suggest"></div>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
            
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
  <div class="md-tabs__inner md-grid">
    <ul class="md-tabs__list">
      
        
  
  


  
  
  
    <li class="md-tabs__item">
      <a href="../../../.." class="md-tabs__link">
        Getting Started
      </a>
    </li>
  

      
    </ul>
  </div>
</nav>
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

  


  

<nav class="md-nav md-nav--primary md-nav--lifted md-nav--integrated" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../../../.." title="WL4G DOCS" class="md-nav__button md-logo" aria-label="WL4G DOCS" data-md-component="logo">
      
  <img src="../../../../static/images/mylogo.jpeg" alt="logo">

    </a>
    WL4G DOCS
  </label>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
        <input class="md-nav__toggle md-toggle" data-md-toggle="__nav_1" data-md-state="indeterminate" type="checkbox" id="__nav_1" checked>
      
      
      
      
        <label class="md-nav__link" for="__nav_1">
          Getting Started
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" aria-label="Getting Started" data-md-level="1">
        <label class="md-nav__title" for="__nav_1">
          <span class="md-nav__icon md-icon"></span>
          Getting Started
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../.." class="md-nav__link">
        Introduction
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../../../ABOUT_CN/" class="md-nav__link">
        About
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
          
          <div class="md-content" data-md-component="content">
            <article class="md-content__inner md-typeset">
              
                


<h1 id="cmak-kafka-manager">快速部署之 cmak / kafka-manager<a class="headerlink" href="#cmak-kafka-manager" title="Permanent link">&para;</a></h1>
<ul>
<li><a href="https://www.cnblogs.com/frankdeng/p/9584870.html">参考 1: 编译部署 kafka-manager</a></li>
</ul>
<p>请一定要注意版本匹配，本文使用 kafka-2.12-2.5.0 + cmak-2.0.0.2(kafka-manager-2.0.0.2)，踩过的抗，如使用 cmak-3.0.0.5 连接 kafka-2.12-2.5.0/zookeeper-3.4.6 会报错如<code>UnsupportedClassVersionError: controllers/routes has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0</code>。</p>
<h2 id="1">1. 编译安装<a class="headerlink" href="#1" title="Permanent link">&para;</a></h2>
<h3 id="11">1.1 编译<a class="headerlink" href="#11" title="Permanent link">&para;</a></h3>
<ul>
<li><a href="https://www.scala-lang.org/download/all.html">scala 离线安装: scala-lang.org/download/all.html</a></li>
<li><a href="https://www.scala-sbt.org/download.html">sbt 离线安装: scala-sbt.org/download.html</a></li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1"></a><a href="#__codelineno-0-1"><span class="linenos" data-linenos=" 1 "></span></a>git clone https://github.com/yahoo/CMAK.git <span class="c1"># 新版改名了</span>
<a id="__codelineno-0-2" name="__codelineno-0-2"></a><a href="#__codelineno-0-2"><span class="linenos" data-linenos=" 2 "></span></a><span class="nb">cd</span> CMAK
<a id="__codelineno-0-3" name="__codelineno-0-3"></a><a href="#__codelineno-0-3"><span class="linenos" data-linenos=" 3 "></span></a>git checkout <span class="m">1</span>.3.3.16 <span class="c1"># 注: 这个tag版本的 sbt 脚本中使用了 http://repo.typesafe.com 的地址，要改为 https，新tag版本已修复</span>
<a id="__codelineno-0-4" name="__codelineno-0-4"></a><a href="#__codelineno-0-4"><span class="linenos" data-linenos=" 4 "></span></a>
<a id="__codelineno-0-5" name="__codelineno-0-5"></a><a href="#__codelineno-0-5"><span class="linenos" data-linenos=" 5 "></span></a><span class="c1"># 解决大陆网络慢</span>
<a id="__codelineno-0-6" name="__codelineno-0-6"></a><a href="#__codelineno-0-6"><span class="linenos" data-linenos=" 6 "></span></a>mkdir -p ~/.sbt
<a id="__codelineno-0-7" name="__codelineno-0-7"></a><a href="#__codelineno-0-7"><span class="linenos" data-linenos=" 7 "></span></a>cat <span class="s">&lt;&lt;-&#39;EOF&#39;&gt;~/.sbt/repositories</span>
<a id="__codelineno-0-8" name="__codelineno-0-8"></a><a href="#__codelineno-0-8"><span class="linenos" data-linenos=" 8 "></span></a><span class="s">[repositories]</span>
<a id="__codelineno-0-9" name="__codelineno-0-9"></a><a href="#__codelineno-0-9"><span class="linenos" data-linenos=" 9 "></span></a><span class="s">aliyun: https://maven.aliyun.com/nexus/content/groups/public/</span>
<a id="__codelineno-0-10" name="__codelineno-0-10"></a><a href="#__codelineno-0-10"><span class="linenos" data-linenos="10 "></span></a><span class="s">typesafe: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly</span>
<a id="__codelineno-0-11" name="__codelineno-0-11"></a><a href="#__codelineno-0-11"><span class="linenos" data-linenos="11 "></span></a><span class="s">sonatype-oss-releases</span>
<a id="__codelineno-0-12" name="__codelineno-0-12"></a><a href="#__codelineno-0-12"><span class="linenos" data-linenos="12 "></span></a><span class="s">maven-central</span>
<a id="__codelineno-0-13" name="__codelineno-0-13"></a><a href="#__codelineno-0-13"><span class="linenos" data-linenos="13 "></span></a><span class="s">sonatype-oss-snapshots</span>
<a id="__codelineno-0-14" name="__codelineno-0-14"></a><a href="#__codelineno-0-14"><span class="linenos" data-linenos="14 "></span></a><span class="s">EOF</span>
<a id="__codelineno-0-15" name="__codelineno-0-15"></a><a href="#__codelineno-0-15"><span class="linenos" data-linenos="15 "></span></a>
<a id="__codelineno-0-16" name="__codelineno-0-16"></a><a href="#__codelineno-0-16"><span class="linenos" data-linenos="16 "></span></a>./sbt clean dist
</code></pre></div>
<ul>
<li>
<p>过程较慢，如果重试几次还不行就得配置科学上网吧，<a href="https://blogs.wl4g.com/archives/121">参考 2: Linux轻松搭建Shadowsocks服务器</a></p>
</li>
<li>
<p><strong>直接下载已编译包</strong></p>
</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1"></a><a href="#__codelineno-1-1"><span class="linenos" data-linenos="1 "></span></a><span class="c1"># Installing</span>
<a id="__codelineno-1-2" name="__codelineno-1-2"></a><a href="#__codelineno-1-2"><span class="linenos" data-linenos="2 "></span></a>mkdir -p /opt/apps/emr
<a id="__codelineno-1-3" name="__codelineno-1-3"></a><a href="#__codelineno-1-3"><span class="linenos" data-linenos="3 "></span></a><span class="nb">cd</span> /opt/apps/emr
<a id="__codelineno-1-4" name="__codelineno-1-4"></a><a href="#__codelineno-1-4"><span class="linenos" data-linenos="4 "></span></a>wget https://gitee.com/wl4g-collect/kafka-manager/attach_files/836364/download/kafka-manager-1.3.3.16.zip
<a id="__codelineno-1-5" name="__codelineno-1-5"></a><a href="#__codelineno-1-5"><span class="linenos" data-linenos="5 "></span></a>unzip kafka-manager-1.3.3.16.zip
<a id="__codelineno-1-6" name="__codelineno-1-6"></a><a href="#__codelineno-1-6"><span class="linenos" data-linenos="6 "></span></a>
<a id="__codelineno-1-7" name="__codelineno-1-7"></a><a href="#__codelineno-1-7"><span class="linenos" data-linenos="7 "></span></a><span class="c1"># Link kafka-manager home directory.</span>
<a id="__codelineno-1-8" name="__codelineno-1-8"></a><a href="#__codelineno-1-8"><span class="linenos" data-linenos="8 "></span></a>ln -snf <span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span>/<span class="k">$(</span>ls <span class="p">|</span>grep kafka-manager<span class="k">)</span> /usr/lib/kafka-manager-current
</code></pre></div>
<h2 id="2">2. 主机部署<a class="headerlink" href="#2" title="Permanent link">&para;</a></h2>
<h3 id="21">2.1 环境配置<a class="headerlink" href="#21" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1"></a><a href="#__codelineno-2-1"><span class="linenos" data-linenos=" 1 "></span></a>cat <span class="s">&lt;&lt;-&#39;EOF&#39;&gt; /etc/profile.d/profile-kafka-manager.sh</span>
<a id="__codelineno-2-2" name="__codelineno-2-2"></a><a href="#__codelineno-2-2"><span class="linenos" data-linenos=" 2 "></span></a><span class="s">#/*</span>
<a id="__codelineno-2-3" name="__codelineno-2-3"></a><a href="#__codelineno-2-3"><span class="linenos" data-linenos=" 3 "></span></a><span class="s"># * Copyright 2017 ~ 2025 the original author or authors. &lt;wanglsir@gmail.com, 983708408@qq.com&gt;</span>
<a id="__codelineno-2-4" name="__codelineno-2-4"></a><a href="#__codelineno-2-4"><span class="linenos" data-linenos=" 4 "></span></a><span class="s"># *</span>
<a id="__codelineno-2-5" name="__codelineno-2-5"></a><a href="#__codelineno-2-5"><span class="linenos" data-linenos=" 5 "></span></a><span class="s"># * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<a id="__codelineno-2-6" name="__codelineno-2-6"></a><a href="#__codelineno-2-6"><span class="linenos" data-linenos=" 6 "></span></a><span class="s"># * you may not use this file except in compliance with the License.</span>
<a id="__codelineno-2-7" name="__codelineno-2-7"></a><a href="#__codelineno-2-7"><span class="linenos" data-linenos=" 7 "></span></a><span class="s"># * You may obtain a copy of the License at</span>
<a id="__codelineno-2-8" name="__codelineno-2-8"></a><a href="#__codelineno-2-8"><span class="linenos" data-linenos=" 8 "></span></a><span class="s"># *</span>
<a id="__codelineno-2-9" name="__codelineno-2-9"></a><a href="#__codelineno-2-9"><span class="linenos" data-linenos=" 9 "></span></a><span class="s"># *      http://www.apache.org/licenses/LICE</span>NSE-2.0
<a id="__codelineno-2-10" name="__codelineno-2-10"></a><a href="#__codelineno-2-10"><span class="linenos" data-linenos="10 "></span></a><span class="c1"># *</span>
<a id="__codelineno-2-11" name="__codelineno-2-11"></a><a href="#__codelineno-2-11"><span class="linenos" data-linenos="11 "></span></a><span class="c1"># * Unless required by applicable law or agreed to in writing, software</span>
<a id="__codelineno-2-12" name="__codelineno-2-12"></a><a href="#__codelineno-2-12"><span class="linenos" data-linenos="12 "></span></a><span class="c1"># * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a id="__codelineno-2-13" name="__codelineno-2-13"></a><a href="#__codelineno-2-13"><span class="linenos" data-linenos="13 "></span></a><span class="c1"># * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a id="__codelineno-2-14" name="__codelineno-2-14"></a><a href="#__codelineno-2-14"><span class="linenos" data-linenos="14 "></span></a><span class="c1"># * See the License for the specific language governing permissions and</span>
<a id="__codelineno-2-15" name="__codelineno-2-15"></a><a href="#__codelineno-2-15"><span class="linenos" data-linenos="15 "></span></a><span class="c1"># * limitations under the License.</span>
<a id="__codelineno-2-16" name="__codelineno-2-16"></a><a href="#__codelineno-2-16"><span class="linenos" data-linenos="16 "></span></a><span class="c1"># */</span>
<a id="__codelineno-2-17" name="__codelineno-2-17"></a><a href="#__codelineno-2-17"><span class="linenos" data-linenos="17 "></span></a><span class="nb">export</span> <span class="nv">KAFKA_MANAGER_HOME</span><span class="o">=</span>/usr/lib/kafka-manager-current
<a id="__codelineno-2-18" name="__codelineno-2-18"></a><a href="#__codelineno-2-18"><span class="linenos" data-linenos="18 "></span></a><span class="nb">export</span> <span class="nv">KAFKA_MANAGER_CONF_DIR</span><span class="o">=</span>/etc/emr/kafka-manager-conf
<a id="__codelineno-2-19" name="__codelineno-2-19"></a><a href="#__codelineno-2-19"><span class="linenos" data-linenos="19 "></span></a><span class="nb">export</span> <span class="nv">KAFKA_MANAGER_DATA_DIR</span><span class="o">=</span>/mnt/disk1/kafka-manager
<a id="__codelineno-2-20" name="__codelineno-2-20"></a><a href="#__codelineno-2-20"><span class="linenos" data-linenos="20 "></span></a><span class="nb">export</span> <span class="nv">KAFKA_MANAGER_LOG_DIR</span><span class="o">=</span>/mnt/disk1/log/kafka-manager
<a id="__codelineno-2-21" name="__codelineno-2-21"></a><a href="#__codelineno-2-21"><span class="linenos" data-linenos="21 "></span></a><span class="nb">export</span> <span class="nv">KAFKA_MANAGER_OPTS</span><span class="o">=</span><span class="s2">&quot;-Dhttp.port=9990&quot;</span>
<a id="__codelineno-2-22" name="__codelineno-2-22"></a><a href="#__codelineno-2-22"><span class="linenos" data-linenos="22 "></span></a><span class="nb">export</span> <span class="nv">PATH</span><span class="o">=</span><span class="nv">$PATH</span>:<span class="nv">$KAFKA_MANAGER_HOME</span>/bin
</code></pre></div>
<h3 id="23">2.3 运行配置<a class="headerlink" href="#23" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1"></a><a href="#__codelineno-3-1"><span class="linenos" data-linenos="1 "></span></a><span class="c1"># 手动编辑修改 zookeeper 连接地址</span>
<a id="__codelineno-3-2" name="__codelineno-3-2"></a><a href="#__codelineno-3-2"><span class="linenos" data-linenos="2 "></span></a><span class="nv">$KAFKA_MANAGER_CONF_DIR</span>/application.conf
<a id="__codelineno-3-3" name="__codelineno-3-3"></a><a href="#__codelineno-3-3"><span class="linenos" data-linenos="3 "></span></a><span class="c1"># 找到 kafka-manager.zkhosts</span>
</code></pre></div>
<h3 id="24">2.4 管理脚本<a class="headerlink" href="#24" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1"></a><a href="#__codelineno-4-1"><span class="linenos" data-linenos="  1 "></span></a>cat <span class="s">&lt;&lt;-&#39;EOF&#39;&gt; /etc/init.d/kafka-manager.sh</span>
<a id="__codelineno-4-2" name="__codelineno-4-2"></a><a href="#__codelineno-4-2"><span class="linenos" data-linenos="  2 "></span></a><span class="s">#!/bin/bash</span>
<a id="__codelineno-4-3" name="__codelineno-4-3"></a><a href="#__codelineno-4-3"><span class="linenos" data-linenos="  3 "></span></a><span class="s"># chkconfig: - 85 15</span>
<a id="__codelineno-4-4" name="__codelineno-4-4"></a><a href="#__codelineno-4-4"><span class="linenos" data-linenos="  4 "></span></a><span class="s">#/*</span>
<a id="__codelineno-4-5" name="__codelineno-4-5"></a><a href="#__codelineno-4-5"><span class="linenos" data-linenos="  5 "></span></a><span class="s"># * Copyright 2017 ~ 2025 the original author or authors. &lt;Wanglsir@gmail.com, 983708408@qq.com&gt;</span>
<a id="__codelineno-4-6" name="__codelineno-4-6"></a><a href="#__codelineno-4-6"><span class="linenos" data-linenos="  6 "></span></a><span class="s"># *</span>
<a id="__codelineno-4-7" name="__codelineno-4-7"></a><a href="#__codelineno-4-7"><span class="linenos" data-linenos="  7 "></span></a><span class="s"># * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<a id="__codelineno-4-8" name="__codelineno-4-8"></a><a href="#__codelineno-4-8"><span class="linenos" data-linenos="  8 "></span></a><span class="s"># * you may not use this file except in compliance with the License.</span>
<a id="__codelineno-4-9" name="__codelineno-4-9"></a><a href="#__codelineno-4-9"><span class="linenos" data-linenos="  9 "></span></a><span class="s"># * You may obtain a copy of the License at</span>
<a id="__codelineno-4-10" name="__codelineno-4-10"></a><a href="#__codelineno-4-10"><span class="linenos" data-linenos=" 10 "></span></a><span class="s"># *</span>
<a id="__codelineno-4-11" name="__codelineno-4-11"></a><a href="#__codelineno-4-11"><span class="linenos" data-linenos=" 11 "></span></a><span class="s"># *      http://www.apache.org/licenses/LICENSE-2.0</span>
<a id="__codelineno-4-12" name="__codelineno-4-12"></a><a href="#__codelineno-4-12"><span class="linenos" data-linenos=" 12 "></span></a><span class="s"># *</span>
<a id="__codelineno-4-13" name="__codelineno-4-13"></a><a href="#__codelineno-4-13"><span class="linenos" data-linenos=" 13 "></span></a><span class="s"># * Unless required by applicable law or agreed to in writing, software</span>
<a id="__codelineno-4-14" name="__codelineno-4-14"></a><a href="#__codelineno-4-14"><span class="linenos" data-linenos=" 14 "></span></a><span class="s"># * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a id="__codelineno-4-15" name="__codelineno-4-15"></a><a href="#__codelineno-4-15"><span class="linenos" data-linenos=" 15 "></span></a><span class="s"># * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a id="__codelineno-4-16" name="__codelineno-4-16"></a><a href="#__codelineno-4-16"><span class="linenos" data-linenos=" 16 "></span></a><span class="s"># * See the License for the specific language governing permissions and</span>
<a id="__codelineno-4-17" name="__codelineno-4-17"></a><a href="#__codelineno-4-17"><span class="linenos" data-linenos=" 17 "></span></a><span class="s"># * limitations under the License.</span>
<a id="__codelineno-4-18" name="__codelineno-4-18"></a><a href="#__codelineno-4-18"><span class="linenos" data-linenos=" 18 "></span></a><span class="s"># */</span>
<a id="__codelineno-4-19" name="__codelineno-4-19"></a><a href="#__codelineno-4-19"><span class="linenos" data-linenos=" 19 "></span></a><span class="s">#</span>
<a id="__codelineno-4-20" name="__codelineno-4-20"></a><a href="#__codelineno-4-20"><span class="linenos" data-linenos=" 20 "></span></a><span class="s">[ -f /etc/sysconfig/network ] &amp;&amp; . /etc/sysconfig/network</span>
<a id="__codelineno-4-21" name="__codelineno-4-21"></a><a href="#__codelineno-4-21"><span class="linenos" data-linenos=" 21 "></span></a><span class="s">[ &quot;$NETWORKING&quot; = &quot;no&quot; ] &amp;&amp; exit 0</span>
<a id="__codelineno-4-22" name="__codelineno-4-22"></a><a href="#__codelineno-4-22"><span class="linenos" data-linenos=" 22 "></span></a><span class="s">#</span>
<a id="__codelineno-4-23" name="__codelineno-4-23"></a><a href="#__codelineno-4-23"><span class="linenos" data-linenos=" 23 "></span></a><span class="s"># Load the user environment.</span>
<a id="__codelineno-4-24" name="__codelineno-4-24"></a><a href="#__codelineno-4-24"><span class="linenos" data-linenos=" 24 "></span></a><span class="s">[ -f &quot;/etc/bashrc&quot; ] &amp;&amp; . /etc/bashrc</span>
<a id="__codelineno-4-25" name="__codelineno-4-25"></a><a href="#__codelineno-4-25"><span class="linenos" data-linenos=" 25 "></span></a><span class="s">[ -f &quot;/etc/bash.bashrc&quot; ] &amp;&amp; . /etc/bash.bashrc # e.g ubuntu</span>
<a id="__codelineno-4-26" name="__codelineno-4-26"></a><a href="#__codelineno-4-26"><span class="linenos" data-linenos=" 26 "></span></a><span class="s">if [ &quot;$USER&quot; == &quot;root&quot; ]; then</span>
<a id="__codelineno-4-27" name="__codelineno-4-27"></a><a href="#__codelineno-4-27"><span class="linenos" data-linenos=" 27 "></span></a><span class="s">  . &quot;/root/.bash_profile&quot;</span>
<a id="__codelineno-4-28" name="__codelineno-4-28"></a><a href="#__codelineno-4-28"><span class="linenos" data-linenos=" 28 "></span></a><span class="s">  . &quot;/root/.bashrc&quot;</span>
<a id="__codelineno-4-29" name="__codelineno-4-29"></a><a href="#__codelineno-4-29"><span class="linenos" data-linenos=" 29 "></span></a><span class="s">else</span>
<a id="__codelineno-4-30" name="__codelineno-4-30"></a><a href="#__codelineno-4-30"><span class="linenos" data-linenos=" 30 "></span></a><span class="s">  [ -f &quot;/home/$USER/.bash_profile&quot; ] &amp;&amp; . /home/$USER/.bash_profile</span>
<a id="__codelineno-4-31" name="__codelineno-4-31"></a><a href="#__codelineno-4-31"><span class="linenos" data-linenos=" 31 "></span></a><span class="s">  [ -f &quot;/home/$USER/.bashrc&quot; ] &amp;&amp; . /home/$USER/.bashrc</span>
<a id="__codelineno-4-32" name="__codelineno-4-32"></a><a href="#__codelineno-4-32"><span class="linenos" data-linenos=" 32 "></span></a><span class="s">  # Mac OS</span>
<a id="__codelineno-4-33" name="__codelineno-4-33"></a><a href="#__codelineno-4-33"><span class="linenos" data-linenos=" 33 "></span></a><span class="s">  [ -f &quot;/Users/$USER/.bash_profile&quot; ] &amp;&amp; . /Users/$USER/.bash_profile</span>
<a id="__codelineno-4-34" name="__codelineno-4-34"></a><a href="#__codelineno-4-34"><span class="linenos" data-linenos=" 34 "></span></a><span class="s">  [ -f &quot;/Users/$USER/.bashrc&quot; ] &amp;&amp; . /Users/$USER/.bashrc</span>
<a id="__codelineno-4-35" name="__codelineno-4-35"></a><a href="#__codelineno-4-35"><span class="linenos" data-linenos=" 35 "></span></a><span class="s">fi</span>
<a id="__codelineno-4-36" name="__codelineno-4-36"></a><a href="#__codelineno-4-36"><span class="linenos" data-linenos=" 36 "></span></a><span class="s">[ -f &quot;/etc/profile.d/profile-kafka-manager.sh&quot; ] &amp;&amp; . /etc/profile.d/profile-kafka-manager.sh</span>
<a id="__codelineno-4-37" name="__codelineno-4-37"></a><a href="#__codelineno-4-37"><span class="linenos" data-linenos=" 37 "></span></a>
<a id="__codelineno-4-38" name="__codelineno-4-38"></a><a href="#__codelineno-4-38"><span class="linenos" data-linenos=" 38 "></span></a><span class="s"># Initialize directory. (if not exists)</span>
<a id="__codelineno-4-39" name="__codelineno-4-39"></a><a href="#__codelineno-4-39"><span class="linenos" data-linenos=" 39 "></span></a><span class="s">mkdir -p $KAFKA_MANAGER_CONF_DIR</span>
<a id="__codelineno-4-40" name="__codelineno-4-40"></a><a href="#__codelineno-4-40"><span class="linenos" data-linenos=" 40 "></span></a><span class="s">mkdir -p $KAFKA_MANAGER_DATA_DIR</span>
<a id="__codelineno-4-41" name="__codelineno-4-41"></a><a href="#__codelineno-4-41"><span class="linenos" data-linenos=" 41 "></span></a><span class="s">mkdir -p $KAFKA_MANAGER_LOG_DIR</span>
<a id="__codelineno-4-42" name="__codelineno-4-42"></a><a href="#__codelineno-4-42"><span class="linenos" data-linenos=" 42 "></span></a>
<a id="__codelineno-4-43" name="__codelineno-4-43"></a><a href="#__codelineno-4-43"><span class="linenos" data-linenos=" 43 "></span></a><span class="s">function start() {</span>
<a id="__codelineno-4-44" name="__codelineno-4-44"></a><a href="#__codelineno-4-44"><span class="linenos" data-linenos=" 44 "></span></a><span class="s">  local jvmOpts=${KAFKA_MANAGER_OPTS:-Dhttp.port=9000}</span>
<a id="__codelineno-4-45" name="__codelineno-4-45"></a><a href="#__codelineno-4-45"><span class="linenos" data-linenos=" 45 "></span></a><span class="s">  local pids=$(getPids)</span>
<a id="__codelineno-4-46" name="__codelineno-4-46"></a><a href="#__codelineno-4-46"><span class="linenos" data-linenos=" 46 "></span></a><span class="s">  if [ -z &quot;$pids&quot; ]; then</span>
<a id="__codelineno-4-47" name="__codelineno-4-47"></a><a href="#__codelineno-4-47"><span class="linenos" data-linenos=" 47 "></span></a><span class="s">    # Must remove.</span>
<a id="__codelineno-4-48" name="__codelineno-4-48"></a><a href="#__codelineno-4-48"><span class="linenos" data-linenos=" 48 "></span></a><span class="s">    rm -rf $KAFKA_MANAGER_HOME/RUNNING_PID</span>
<a id="__codelineno-4-49" name="__codelineno-4-49"></a><a href="#__codelineno-4-49"><span class="linenos" data-linenos=" 49 "></span></a><span class="s">    rm -rf $KAFKA_MANAGER_HOME/application.home*</span>
<a id="__codelineno-4-50" name="__codelineno-4-50"></a><a href="#__codelineno-4-50"><span class="linenos" data-linenos=" 50 "></span></a><span class="s">    if [ &quot;$PPID&quot; == &quot;1&quot; ]; then # Systemd call.</span>
<a id="__codelineno-4-51" name="__codelineno-4-51"></a><a href="#__codelineno-4-51"><span class="linenos" data-linenos=" 51 "></span></a><span class="s">      $KAFKA_MANAGER_HOME/bin/kafka-manager -Dconfig.file=$KAFKA_MANAGER_CONF_DIR/application.conf ${jvmOpts} &gt;&quot;$KAFKA_MANAGER_LOG_DIR/kafka-manager.stdout&quot; 2&gt;&amp;1</span>
<a id="__codelineno-4-52" name="__codelineno-4-52"></a><a href="#__codelineno-4-52"><span class="linenos" data-linenos=" 52 "></span></a><span class="s">    else # Normal shell call.</span>
<a id="__codelineno-4-53" name="__codelineno-4-53"></a><a href="#__codelineno-4-53"><span class="linenos" data-linenos=" 53 "></span></a><span class="s">      nohup $KAFKA_MANAGER_HOME/bin/kafka-manager -Dconfig.file=$KAFKA_MANAGER_CONF_DIR/application.conf ${jvmOpts} &gt;&quot;$KAFKA_MANAGER_LOG_DIR/kafka-manager.stdout&quot; 2&gt;&amp;1 &amp;</span>
<a id="__codelineno-4-54" name="__codelineno-4-54"></a><a href="#__codelineno-4-54"><span class="linenos" data-linenos=" 54 "></span></a><span class="s">    fi</span>
<a id="__codelineno-4-55" name="__codelineno-4-55"></a><a href="#__codelineno-4-55"><span class="linenos" data-linenos=" 55 "></span></a>
<a id="__codelineno-4-56" name="__codelineno-4-56"></a><a href="#__codelineno-4-56"><span class="linenos" data-linenos=" 56 "></span></a><span class="s">    echo -n &quot;Starting kafka-manager ...&quot;</span>
<a id="__codelineno-4-57" name="__codelineno-4-57"></a><a href="#__codelineno-4-57"><span class="linenos" data-linenos=" 57 "></span></a><span class="s">    while true</span>
<a id="__codelineno-4-58" name="__codelineno-4-58"></a><a href="#__codelineno-4-58"><span class="linenos" data-linenos=" 58 "></span></a><span class="s">    do</span>
<a id="__codelineno-4-59" name="__codelineno-4-59"></a><a href="#__codelineno-4-59"><span class="linenos" data-linenos=" 59 "></span></a><span class="s">      pids=$(getPids)</span>
<a id="__codelineno-4-60" name="__codelineno-4-60"></a><a href="#__codelineno-4-60"><span class="linenos" data-linenos=" 60 "></span></a><span class="s">      if [ &quot;$pids&quot; == &quot;&quot; ]; then</span>
<a id="__codelineno-4-61" name="__codelineno-4-61"></a><a href="#__codelineno-4-61"><span class="linenos" data-linenos=" 61 "></span></a><span class="s">        echo -n &quot;.&quot;;</span>
<a id="__codelineno-4-62" name="__codelineno-4-62"></a><a href="#__codelineno-4-62"><span class="linenos" data-linenos=" 62 "></span></a><span class="s">        sleep 0.8;</span>
<a id="__codelineno-4-63" name="__codelineno-4-63"></a><a href="#__codelineno-4-63"><span class="linenos" data-linenos=" 63 "></span></a><span class="s">      else</span>
<a id="__codelineno-4-64" name="__codelineno-4-64"></a><a href="#__codelineno-4-64"><span class="linenos" data-linenos=" 64 "></span></a><span class="s">        echo $pids &gt;&quot;$KAFKA_MANAGER_DATA_DIR/kafka-manager.pid&quot;</span>
<a id="__codelineno-4-65" name="__codelineno-4-65"></a><a href="#__codelineno-4-65"><span class="linenos" data-linenos=" 65 "></span></a><span class="s">        break</span>
<a id="__codelineno-4-66" name="__codelineno-4-66"></a><a href="#__codelineno-4-66"><span class="linenos" data-linenos=" 66 "></span></a><span class="s">      fi</span>
<a id="__codelineno-4-67" name="__codelineno-4-67"></a><a href="#__codelineno-4-67"><span class="linenos" data-linenos=" 67 "></span></a><span class="s">    done</span>
<a id="__codelineno-4-68" name="__codelineno-4-68"></a><a href="#__codelineno-4-68"><span class="linenos" data-linenos=" 68 "></span></a><span class="s">    echo -e &quot;\nStarted kafka-manager on &quot;$pids</span>
<a id="__codelineno-4-69" name="__codelineno-4-69"></a><a href="#__codelineno-4-69"><span class="linenos" data-linenos=" 69 "></span></a><span class="s">  else</span>
<a id="__codelineno-4-70" name="__codelineno-4-70"></a><a href="#__codelineno-4-70"><span class="linenos" data-linenos=" 70 "></span></a><span class="s">    echo &quot;kafka-manager process is running &quot;$pids</span>
<a id="__codelineno-4-71" name="__codelineno-4-71"></a><a href="#__codelineno-4-71"><span class="linenos" data-linenos=" 71 "></span></a><span class="s">  fi</span>
<a id="__codelineno-4-72" name="__codelineno-4-72"></a><a href="#__codelineno-4-72"><span class="linenos" data-linenos=" 72 "></span></a><span class="s">}</span>
<a id="__codelineno-4-73" name="__codelineno-4-73"></a><a href="#__codelineno-4-73"><span class="linenos" data-linenos=" 73 "></span></a>
<a id="__codelineno-4-74" name="__codelineno-4-74"></a><a href="#__codelineno-4-74"><span class="linenos" data-linenos=" 74 "></span></a><span class="s">function stop() {</span>
<a id="__codelineno-4-75" name="__codelineno-4-75"></a><a href="#__codelineno-4-75"><span class="linenos" data-linenos=" 75 "></span></a><span class="s">  local pids=$(getPids)</span>
<a id="__codelineno-4-76" name="__codelineno-4-76"></a><a href="#__codelineno-4-76"><span class="linenos" data-linenos=" 76 "></span></a><span class="s">  if [ -z &quot;$pids&quot; ]; then</span>
<a id="__codelineno-4-77" name="__codelineno-4-77"></a><a href="#__codelineno-4-77"><span class="linenos" data-linenos=" 77 "></span></a><span class="s">    echo &quot;kafka-manager not running!&quot;</span>
<a id="__codelineno-4-78" name="__codelineno-4-78"></a><a href="#__codelineno-4-78"><span class="linenos" data-linenos=" 78 "></span></a><span class="s">  else</span>
<a id="__codelineno-4-79" name="__codelineno-4-79"></a><a href="#__codelineno-4-79"><span class="linenos" data-linenos=" 79 "></span></a><span class="s">    echo -n &quot;Stopping kafka-manager for $pids ...&quot;</span>
<a id="__codelineno-4-80" name="__codelineno-4-80"></a><a href="#__codelineno-4-80"><span class="linenos" data-linenos=" 80 "></span></a><span class="s">    kill -s TERM $pids</span>
<a id="__codelineno-4-81" name="__codelineno-4-81"></a><a href="#__codelineno-4-81"><span class="linenos" data-linenos=" 81 "></span></a><span class="s">    while true</span>
<a id="__codelineno-4-82" name="__codelineno-4-82"></a><a href="#__codelineno-4-82"><span class="linenos" data-linenos=" 82 "></span></a><span class="s">    do</span>
<a id="__codelineno-4-83" name="__codelineno-4-83"></a><a href="#__codelineno-4-83"><span class="linenos" data-linenos=" 83 "></span></a><span class="s">      pids=$(getPids)</span>
<a id="__codelineno-4-84" name="__codelineno-4-84"></a><a href="#__codelineno-4-84"><span class="linenos" data-linenos=" 84 "></span></a><span class="s">      if [ &quot;$pids&quot; == &quot;&quot; ]; then</span>
<a id="__codelineno-4-85" name="__codelineno-4-85"></a><a href="#__codelineno-4-85"><span class="linenos" data-linenos=" 85 "></span></a><span class="s">        \rm -f $KAFKA_MANAGER_DATA_DIR/kafka-manager.pid</span>
<a id="__codelineno-4-86" name="__codelineno-4-86"></a><a href="#__codelineno-4-86"><span class="linenos" data-linenos=" 86 "></span></a><span class="s">        break</span>
<a id="__codelineno-4-87" name="__codelineno-4-87"></a><a href="#__codelineno-4-87"><span class="linenos" data-linenos=" 87 "></span></a><span class="s">      else</span>
<a id="__codelineno-4-88" name="__codelineno-4-88"></a><a href="#__codelineno-4-88"><span class="linenos" data-linenos=" 88 "></span></a><span class="s">        echo -n &quot;.&quot;;</span>
<a id="__codelineno-4-89" name="__codelineno-4-89"></a><a href="#__codelineno-4-89"><span class="linenos" data-linenos=" 89 "></span></a><span class="s">        sleep 0.8;</span>
<a id="__codelineno-4-90" name="__codelineno-4-90"></a><a href="#__codelineno-4-90"><span class="linenos" data-linenos=" 90 "></span></a><span class="s">      fi</span>
<a id="__codelineno-4-91" name="__codelineno-4-91"></a><a href="#__codelineno-4-91"><span class="linenos" data-linenos=" 91 "></span></a><span class="s">    done</span>
<a id="__codelineno-4-92" name="__codelineno-4-92"></a><a href="#__codelineno-4-92"><span class="linenos" data-linenos=" 92 "></span></a><span class="s">    echo -e &quot;\nStopped kafka-manager !&quot;</span>
<a id="__codelineno-4-93" name="__codelineno-4-93"></a><a href="#__codelineno-4-93"><span class="linenos" data-linenos=" 93 "></span></a><span class="s">  fi</span>
<a id="__codelineno-4-94" name="__codelineno-4-94"></a><a href="#__codelineno-4-94"><span class="linenos" data-linenos=" 94 "></span></a><span class="s">}</span>
<a id="__codelineno-4-95" name="__codelineno-4-95"></a><a href="#__codelineno-4-95"><span class="linenos" data-linenos=" 95 "></span></a>
<a id="__codelineno-4-96" name="__codelineno-4-96"></a><a href="#__codelineno-4-96"><span class="linenos" data-linenos=" 96 "></span></a><span class="s">function status() {</span>
<a id="__codelineno-4-97" name="__codelineno-4-97"></a><a href="#__codelineno-4-97"><span class="linenos" data-linenos=" 97 "></span></a><span class="s">  ps -ef | grep -v grep | grep $KAFKA_MANAGER_CONF_DIR</span>
<a id="__codelineno-4-98" name="__codelineno-4-98"></a><a href="#__codelineno-4-98"><span class="linenos" data-linenos=" 98 "></span></a><span class="s">}</span>
<a id="__codelineno-4-99" name="__codelineno-4-99"></a><a href="#__codelineno-4-99"><span class="linenos" data-linenos=" 99 "></span></a>
<a id="__codelineno-4-100" name="__codelineno-4-100"></a><a href="#__codelineno-4-100"><span class="linenos" data-linenos="100 "></span></a><span class="s">function getPids() {</span>
<a id="__codelineno-4-101" name="__codelineno-4-101"></a><a href="#__codelineno-4-101"><span class="linenos" data-linenos="101 "></span></a><span class="s">  local pids=$(ps ax | grep -i &quot;$KAFKA_MANAGER_CONF_DIR&quot; | grep -v grep | awk &#39;{print $1}&#39;)</span>
<a id="__codelineno-4-102" name="__codelineno-4-102"></a><a href="#__codelineno-4-102"><span class="linenos" data-linenos="102 "></span></a><span class="s">  echo $pids # Output execution result value.</span>
<a id="__codelineno-4-103" name="__codelineno-4-103"></a><a href="#__codelineno-4-103"><span class="linenos" data-linenos="103 "></span></a><span class="s">  return 0 # Return the execution result code.</span>
<a id="__codelineno-4-104" name="__codelineno-4-104"></a><a href="#__codelineno-4-104"><span class="linenos" data-linenos="104 "></span></a><span class="s">}</span>
<a id="__codelineno-4-105" name="__codelineno-4-105"></a><a href="#__codelineno-4-105"><span class="linenos" data-linenos="105 "></span></a>
<a id="__codelineno-4-106" name="__codelineno-4-106"></a><a href="#__codelineno-4-106"><span class="linenos" data-linenos="106 "></span></a><span class="s"># --- Main call. ---</span>
<a id="__codelineno-4-107" name="__codelineno-4-107"></a><a href="#__codelineno-4-107"><span class="linenos" data-linenos="107 "></span></a><span class="s">case $1 in</span>
<a id="__codelineno-4-108" name="__codelineno-4-108"></a><a href="#__codelineno-4-108"><span class="linenos" data-linenos="108 "></span></a><span class="s">  status)</span>
<a id="__codelineno-4-109" name="__codelineno-4-109"></a><a href="#__codelineno-4-109"><span class="linenos" data-linenos="109 "></span></a><span class="s">    status</span>
<a id="__codelineno-4-110" name="__codelineno-4-110"></a><a href="#__codelineno-4-110"><span class="linenos" data-linenos="110 "></span></a><span class="s">    ;;</span>
<a id="__codelineno-4-111" name="__codelineno-4-111"></a><a href="#__codelineno-4-111"><span class="linenos" data-linenos="111 "></span></a><span class="s">  start)</span>
<a id="__codelineno-4-112" name="__codelineno-4-112"></a><a href="#__codelineno-4-112"><span class="linenos" data-linenos="112 "></span></a><span class="s">    start</span>
<a id="__codelineno-4-113" name="__codelineno-4-113"></a><a href="#__codelineno-4-113"><span class="linenos" data-linenos="113 "></span></a><span class="s">    ;;</span>
<a id="__codelineno-4-114" name="__codelineno-4-114"></a><a href="#__codelineno-4-114"><span class="linenos" data-linenos="114 "></span></a><span class="s">  stop)</span>
<a id="__codelineno-4-115" name="__codelineno-4-115"></a><a href="#__codelineno-4-115"><span class="linenos" data-linenos="115 "></span></a><span class="s">    stop</span>
<a id="__codelineno-4-116" name="__codelineno-4-116"></a><a href="#__codelineno-4-116"><span class="linenos" data-linenos="116 "></span></a><span class="s">    ;;</span>
<a id="__codelineno-4-117" name="__codelineno-4-117"></a><a href="#__codelineno-4-117"><span class="linenos" data-linenos="117 "></span></a><span class="s">  restart)</span>
<a id="__codelineno-4-118" name="__codelineno-4-118"></a><a href="#__codelineno-4-118"><span class="linenos" data-linenos="118 "></span></a><span class="s">    stop</span>
<a id="__codelineno-4-119" name="__codelineno-4-119"></a><a href="#__codelineno-4-119"><span class="linenos" data-linenos="119 "></span></a><span class="s">    start</span>
<a id="__codelineno-4-120" name="__codelineno-4-120"></a><a href="#__codelineno-4-120"><span class="linenos" data-linenos="120 "></span></a><span class="s">    ;;</span>
<a id="__codelineno-4-121" name="__codelineno-4-121"></a><a href="#__codelineno-4-121"><span class="linenos" data-linenos="121 "></span></a><span class="s">    *|--help|help)</span>
<a id="__codelineno-4-122" name="__codelineno-4-122"></a><a href="#__codelineno-4-122"><span class="linenos" data-linenos="122 "></span></a><span class="s">  echo $&quot;Usage: {start|stop|restart|status}&quot;</span>
<a id="__codelineno-4-123" name="__codelineno-4-123"></a><a href="#__codelineno-4-123"><span class="linenos" data-linenos="123 "></span></a><span class="s">  exit 2</span>
<a id="__codelineno-4-124" name="__codelineno-4-124"></a><a href="#__codelineno-4-124"><span class="linenos" data-linenos="124 "></span></a><span class="s">esac</span>
<a id="__codelineno-4-125" name="__codelineno-4-125"></a><a href="#__codelineno-4-125"><span class="linenos" data-linenos="125 "></span></a><span class="s">EOF</span>
<a id="__codelineno-4-126" name="__codelineno-4-126"></a><a href="#__codelineno-4-126"><span class="linenos" data-linenos="126 "></span></a>chmod +x /etc/init.d/kafka-manager.sh
</code></pre></div>
<h3 id="25">2.5 服务配置<a class="headerlink" href="#25" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1"></a><a href="#__codelineno-5-1"><span class="linenos" data-linenos=" 1 "></span></a>cat <span class="s">&lt;&lt;-&#39;EOF&#39;&gt; /etc/systemd/system/kafka-manager.service</span>
<a id="__codelineno-5-2" name="__codelineno-5-2"></a><a href="#__codelineno-5-2"><span class="linenos" data-linenos=" 2 "></span></a><span class="s"># Copyright (c) 2017 ~ 2025, the original author wangl.sir individual Inc,</span>
<a id="__codelineno-5-3" name="__codelineno-5-3"></a><a href="#__codelineno-5-3"><span class="linenos" data-linenos=" 3 "></span></a><span class="s"># All rights reserved. Contact us &lt;wanglsir@gmail.com, 983708408@qq.com&gt;</span>
<a id="__codelineno-5-4" name="__codelineno-5-4"></a><a href="#__codelineno-5-4"><span class="linenos" data-linenos=" 4 "></span></a><span class="s">#</span>
<a id="__codelineno-5-5" name="__codelineno-5-5"></a><a href="#__codelineno-5-5"><span class="linenos" data-linenos=" 5 "></span></a><span class="s"># Unless required by applicable law or agreed to in writing, software</span>
<a id="__codelineno-5-6" name="__codelineno-5-6"></a><a href="#__codelineno-5-6"><span class="linenos" data-linenos=" 6 "></span></a><span class="s"># distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<a id="__codelineno-5-7" name="__codelineno-5-7"></a><a href="#__codelineno-5-7"><span class="linenos" data-linenos=" 7 "></span></a><span class="s"># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a id="__codelineno-5-8" name="__codelineno-5-8"></a><a href="#__codelineno-5-8"><span class="linenos" data-linenos=" 8 "></span></a><span class="s"># See the License for the specific language governing permissions and</span>
<a id="__codelineno-5-9" name="__codelineno-5-9"></a><a href="#__codelineno-5-9"><span class="linenos" data-linenos=" 9 "></span></a><span class="s"># limitations under the License.</span>
<a id="__codelineno-5-10" name="__codelineno-5-10"></a><a href="#__codelineno-5-10"><span class="linenos" data-linenos="10 "></span></a><span class="s">#</span>
<a id="__codelineno-5-11" name="__codelineno-5-11"></a><a href="#__codelineno-5-11"><span class="linenos" data-linenos="11 "></span></a><span class="s"># see: https://github.com/yahoo/cmak or https://gitee.com/wl4g-collect/kafka-manager/releases/1.3.3.16</span>
<a id="__codelineno-5-12" name="__codelineno-5-12"></a><a href="#__codelineno-5-12"><span class="linenos" data-linenos="12 "></span></a><span class="s">[Unit]</span>
<a id="__codelineno-5-13" name="__codelineno-5-13"></a><a href="#__codelineno-5-13"><span class="linenos" data-linenos="13 "></span></a><span class="s">Description=Yahoo CMAK for Apache Kafka</span>
<a id="__codelineno-5-14" name="__codelineno-5-14"></a><a href="#__codelineno-5-14"><span class="linenos" data-linenos="14 "></span></a><span class="s">After=network.target</span>
<a id="__codelineno-5-15" name="__codelineno-5-15"></a><a href="#__codelineno-5-15"><span class="linenos" data-linenos="15 "></span></a><span class="s">After=network-online.target</span>
<a id="__codelineno-5-16" name="__codelineno-5-16"></a><a href="#__codelineno-5-16"><span class="linenos" data-linenos="16 "></span></a><span class="s">Wants=network-online.target</span>
<a id="__codelineno-5-17" name="__codelineno-5-17"></a><a href="#__codelineno-5-17"><span class="linenos" data-linenos="17 "></span></a>
<a id="__codelineno-5-18" name="__codelineno-5-18"></a><a href="#__codelineno-5-18"><span class="linenos" data-linenos="18 "></span></a><span class="s">[Service]</span>
<a id="__codelineno-5-19" name="__codelineno-5-19"></a><a href="#__codelineno-5-19"><span class="linenos" data-linenos="19 "></span></a><span class="s">Type=simple</span>
<a id="__codelineno-5-20" name="__codelineno-5-20"></a><a href="#__codelineno-5-20"><span class="linenos" data-linenos="20 "></span></a><span class="s">ExecStart=/bin/bash -c &quot;/etc/init.d/kafka-manager.sh start&quot;</span>
<a id="__codelineno-5-21" name="__codelineno-5-21"></a><a href="#__codelineno-5-21"><span class="linenos" data-linenos="21 "></span></a><span class="s">ExecReload=/bin/bash -c &quot;/etc/init.d/kafka-manager.sh restart&quot;</span>
<a id="__codelineno-5-22" name="__codelineno-5-22"></a><a href="#__codelineno-5-22"><span class="linenos" data-linenos="22 "></span></a><span class="s">ExecStop=/bin/bash -c &quot;/etc/init.d/kafka-manager.sh stop&quot;</span>
<a id="__codelineno-5-23" name="__codelineno-5-23"></a><a href="#__codelineno-5-23"><span class="linenos" data-linenos="23 "></span></a><span class="s">StandardOutput=null</span>
<a id="__codelineno-5-24" name="__codelineno-5-24"></a><a href="#__codelineno-5-24"><span class="linenos" data-linenos="24 "></span></a><span class="s">StandardError=journal+console</span>
<a id="__codelineno-5-25" name="__codelineno-5-25"></a><a href="#__codelineno-5-25"><span class="linenos" data-linenos="25 "></span></a><span class="s">LimitNOFILE=1048576</span>
<a id="__codelineno-5-26" name="__codelineno-5-26"></a><a href="#__codelineno-5-26"><span class="linenos" data-linenos="26 "></span></a><span class="s">LimitNPROC=1048576</span>
<a id="__codelineno-5-27" name="__codelineno-5-27"></a><a href="#__codelineno-5-27"><span class="linenos" data-linenos="27 "></span></a><span class="s">LimitCORE=infinity</span>
<a id="__codelineno-5-28" name="__codelineno-5-28"></a><a href="#__codelineno-5-28"><span class="linenos" data-linenos="28 "></span></a><span class="s">TimeoutStartSec=60</span>
<a id="__codelineno-5-29" name="__codelineno-5-29"></a><a href="#__codelineno-5-29"><span class="linenos" data-linenos="29 "></span></a><span class="s">Restart=always</span>
<a id="__codelineno-5-30" name="__codelineno-5-30"></a><a href="#__codelineno-5-30"><span class="linenos" data-linenos="30 "></span></a><span class="s">KillMode=process</span>
<a id="__codelineno-5-31" name="__codelineno-5-31"></a><a href="#__codelineno-5-31"><span class="linenos" data-linenos="31 "></span></a><span class="s">User=root</span>
<a id="__codelineno-5-32" name="__codelineno-5-32"></a><a href="#__codelineno-5-32"><span class="linenos" data-linenos="32 "></span></a><span class="s">Group=root</span>
<a id="__codelineno-5-33" name="__codelineno-5-33"></a><a href="#__codelineno-5-33"><span class="linenos" data-linenos="33 "></span></a><span class="s">SuccessExitStatus=143</span>
<a id="__codelineno-5-34" name="__codelineno-5-34"></a><a href="#__codelineno-5-34"><span class="linenos" data-linenos="34 "></span></a>
<a id="__codelineno-5-35" name="__codelineno-5-35"></a><a href="#__codelineno-5-35"><span class="linenos" data-linenos="35 "></span></a><span class="s">[Install]</span>
<a id="__codelineno-5-36" name="__codelineno-5-36"></a><a href="#__codelineno-5-36"><span class="linenos" data-linenos="36 "></span></a><span class="s">WantedBy=multi-user.target</span>
<a id="__codelineno-5-37" name="__codelineno-5-37"></a><a href="#__codelineno-5-37"><span class="linenos" data-linenos="37 "></span></a><span class="s">EOF</span>
<a id="__codelineno-5-38" name="__codelineno-5-38"></a><a href="#__codelineno-5-38"><span class="linenos" data-linenos="38 "></span></a>
<a id="__codelineno-5-39" name="__codelineno-5-39"></a><a href="#__codelineno-5-39"><span class="linenos" data-linenos="39 "></span></a><span class="c1"># 启动服务</span>
<a id="__codelineno-5-40" name="__codelineno-5-40"></a><a href="#__codelineno-5-40"><span class="linenos" data-linenos="40 "></span></a>systemctl daemon-reload
<a id="__codelineno-5-41" name="__codelineno-5-41"></a><a href="#__codelineno-5-41"><span class="linenos" data-linenos="41 "></span></a>systemctl <span class="nb">enable</span> kafka-manager
<a id="__codelineno-5-42" name="__codelineno-5-42"></a><a href="#__codelineno-5-42"><span class="linenos" data-linenos="42 "></span></a>systemctl start kafka-manager
<a id="__codelineno-5-43" name="__codelineno-5-43"></a><a href="#__codelineno-5-43"><span class="linenos" data-linenos="43 "></span></a><span class="c1"># 或 /etc/init.d/kafka-manager.sh start</span>
</code></pre></div>
<h3 id="26-ui">2.6 访问 UI<a class="headerlink" href="#26-ui" title="Permanent link">&para;</a></h3>
<p><code>http://kafka-manger-ip:9000</code></p>
<h2 id="3-docker">3. docker 部署<a class="headerlink" href="#3-docker" title="Permanent link">&para;</a></h2>
<ul>
<li>如果容器引擎是containerd，则：</li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1"></a><a href="#__codelineno-6-1"><span class="linenos" data-linenos=" 1 "></span></a><span class="nb">export</span> <span class="nv">baseUrl</span><span class="o">=</span><span class="s1">&#39;https://github.com/containerd/nerdctl/releases/download/v0.21.0/nerdctl-0.21.0-linux-amd64.tar.gz&#39;</span>
<a id="__codelineno-6-2" name="__codelineno-6-2"></a><a href="#__codelineno-6-2"><span class="linenos" data-linenos=" 2 "></span></a>
<a id="__codelineno-6-3" name="__codelineno-6-3"></a><a href="#__codelineno-6-3"><span class="linenos" data-linenos=" 3 "></span></a>curl -OL <span class="nv">$baseUrl</span>
<a id="__codelineno-6-4" name="__codelineno-6-4"></a><a href="#__codelineno-6-4"><span class="linenos" data-linenos=" 4 "></span></a><span class="c1"># 或使用代理加速</span>
<a id="__codelineno-6-5" name="__codelineno-6-5"></a><a href="#__codelineno-6-5"><span class="linenos" data-linenos=" 5 "></span></a>curl -OL <span class="s2">&quot;https://ghproxy.com/</span><span class="nv">$baseUrl</span><span class="s2">&quot;</span>
<a id="__codelineno-6-6" name="__codelineno-6-6"></a><a href="#__codelineno-6-6"><span class="linenos" data-linenos=" 6 "></span></a>
<a id="__codelineno-6-7" name="__codelineno-6-7"></a><a href="#__codelineno-6-7"><span class="linenos" data-linenos=" 7 "></span></a><span class="c1"># 解压安装</span>
<a id="__codelineno-6-8" name="__codelineno-6-8"></a><a href="#__codelineno-6-8"><span class="linenos" data-linenos=" 8 "></span></a>tar -xf nerdctl-*
<a id="__codelineno-6-9" name="__codelineno-6-9"></a><a href="#__codelineno-6-9"><span class="linenos" data-linenos=" 9 "></span></a>mv nerdctl /bin/
<a id="__codelineno-6-10" name="__codelineno-6-10"></a><a href="#__codelineno-6-10"><span class="linenos" data-linenos="10 "></span></a>
<a id="__codelineno-6-11" name="__codelineno-6-11"></a><a href="#__codelineno-6-11"><span class="linenos" data-linenos="11 "></span></a><span class="c1"># 设置别名</span>
<a id="__codelineno-6-12" name="__codelineno-6-12"></a><a href="#__codelineno-6-12"><span class="linenos" data-linenos="12 "></span></a><span class="nb">alias</span> <span class="nv">docker</span><span class="o">=</span><span class="s1">&#39;nerdctl&#39;</span> <span class="c1"># if the engine is containerd.</span>
</code></pre></div>
<h3 id="31-220">3.1 部署老版 (最高仅支持 &lt;=2.2.0)<a class="headerlink" href="#31-220" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><a id="__codelineno-7-1" name="__codelineno-7-1"></a><a href="#__codelineno-7-1"><span class="linenos" data-linenos="1 "></span></a>docker run -d <span class="se">\</span>
<a id="__codelineno-7-2" name="__codelineno-7-2"></a><a href="#__codelineno-7-2"><span class="linenos" data-linenos="2 "></span></a>--name cmak <span class="se">\</span>
<a id="__codelineno-7-3" name="__codelineno-7-3"></a><a href="#__codelineno-7-3"><span class="linenos" data-linenos="3 "></span></a>--network host <span class="se">\</span>
<a id="__codelineno-7-4" name="__codelineno-7-4"></a><a href="#__codelineno-7-4"><span class="linenos" data-linenos="4 "></span></a>--restart always <span class="se">\</span>
<a id="__codelineno-7-5" name="__codelineno-7-5"></a><a href="#__codelineno-7-5"><span class="linenos" data-linenos="5 "></span></a>-e <span class="nv">ZK_HOSTS</span><span class="o">=</span><span class="m">10</span>.0.0.162:2181 <span class="se">\</span>
<a id="__codelineno-7-6" name="__codelineno-7-6"></a><a href="#__codelineno-7-6"><span class="linenos" data-linenos="6 "></span></a>registry.cn-shenzhen.aliyuncs.com/wl4g/kafka-manager:2.0.0.2 -Dhttp.port<span class="o">=</span><span class="m">9000</span>
</code></pre></div>
<h3 id="32-0811-310">3.2 （推荐）部署新版 (&gt;=0.8.1.1 支持 &lt;=3.1.0+)<a class="headerlink" href="#32-0811-310" title="Permanent link">&para;</a></h3>
<ul>
<li>官方说明：<a href="https://hub.docker.com/r/deltaprojects/kafka-manager">hub.docker.com/r/deltaprojects/kafka-manager</a></li>
</ul>
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1"></a><a href="#__codelineno-8-1"><span class="linenos" data-linenos=" 1 "></span></a>docker run <span class="se">\</span>
<a id="__codelineno-8-2" name="__codelineno-8-2"></a><a href="#__codelineno-8-2"><span class="linenos" data-linenos=" 2 "></span></a>--name<span class="o">=</span>cmak <span class="se">\</span>
<a id="__codelineno-8-3" name="__codelineno-8-3"></a><a href="#__codelineno-8-3"><span class="linenos" data-linenos=" 3 "></span></a>--network<span class="o">=</span>bridge <span class="se">\</span>
<a id="__codelineno-8-4" name="__codelineno-8-4"></a><a href="#__codelineno-8-4"><span class="linenos" data-linenos=" 4 "></span></a>--restart<span class="o">=</span>always <span class="se">\</span>
<a id="__codelineno-8-5" name="__codelineno-8-5"></a><a href="#__codelineno-8-5"><span class="linenos" data-linenos=" 5 "></span></a>--detach<span class="o">=</span><span class="nb">true</span> <span class="se">\</span>
<a id="__codelineno-8-6" name="__codelineno-8-6"></a><a href="#__codelineno-8-6"><span class="linenos" data-linenos=" 6 "></span></a>-e<span class="o">=</span><span class="s2">&quot;ZK_HOSTS=172.24.47.4:2181,172.24.47.5:2181,172.24.47.6:2181&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-7" name="__codelineno-8-7"></a><a href="#__codelineno-8-7"><span class="linenos" data-linenos=" 7 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_AUTH_ENABLED=true&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-8" name="__codelineno-8-8"></a><a href="#__codelineno-8-8"><span class="linenos" data-linenos=" 8 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_USERNAME=admin&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-9" name="__codelineno-8-9"></a><a href="#__codelineno-8-9"><span class="linenos" data-linenos=" 9 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_PASSWORD=admin&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-10" name="__codelineno-8-10"></a><a href="#__codelineno-8-10"><span class="linenos" data-linenos="10 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_ENABLED=false&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-11" name="__codelineno-8-11"></a><a href="#__codelineno-8-11"><span class="linenos" data-linenos="11 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_SERVER=ldap.example.com&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-12" name="__codelineno-8-12"></a><a href="#__codelineno-8-12"><span class="linenos" data-linenos="12 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_PORT=636&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-13" name="__codelineno-8-13"></a><a href="#__codelineno-8-13"><span class="linenos" data-linenos="13 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_USERNAME=cn=rouser,dc=example,dc=com&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-14" name="__codelineno-8-14"></a><a href="#__codelineno-8-14"><span class="linenos" data-linenos="14 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_PASSWORD=rouserpassword&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-15" name="__codelineno-8-15"></a><a href="#__codelineno-8-15"><span class="linenos" data-linenos="15 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_SEARCH_BASE_DN=ou=users,dc=example,dc=com&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-16" name="__codelineno-8-16"></a><a href="#__codelineno-8-16"><span class="linenos" data-linenos="16 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_SEARCH_FILTER=(&amp;(objectClass=inetOrgPerson)(&amp;(uid=\$capturedLogin\$)(|(memberof=cn=Operations,ou=Groups,dc=example,dc=com)(memberof=cn=Development,ou=Groups,dc=example,dc=com))))&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-17" name="__codelineno-8-17"></a><a href="#__codelineno-8-17"><span class="linenos" data-linenos="17 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_CONNECTION_POOL_SIZE=10&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-18" name="__codelineno-8-18"></a><a href="#__codelineno-8-18"><span class="linenos" data-linenos="18 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_LDAP_SSL=false&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-19" name="__codelineno-8-19"></a><a href="#__codelineno-8-19"><span class="linenos" data-linenos="19 "></span></a>-e<span class="o">=</span><span class="s2">&quot;KAFKA_MANAGER_EXTRA_PLAY_OPTS=-Dhttp.port=9000 -Dhttps.port=9443&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-20" name="__codelineno-8-20"></a><a href="#__codelineno-8-20"><span class="linenos" data-linenos="20 "></span></a>-e<span class="o">=</span><span class="s2">&quot;APPLICATION_SECRET=abcdefghijklmnopqrstyvwxyz&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-21" name="__codelineno-8-21"></a><a href="#__codelineno-8-21"><span class="linenos" data-linenos="21 "></span></a>-e<span class="o">=</span><span class="s2">&quot;JAVA_OPTS=-Djava.net.preferIPv4Stack=true -Xmx2G&quot;</span> <span class="se">\</span>
<a id="__codelineno-8-22" name="__codelineno-8-22"></a><a href="#__codelineno-8-22"><span class="linenos" data-linenos="22 "></span></a>-p <span class="m">0</span>.0.0.0:1443:9443 <span class="se">\</span>
<a id="__codelineno-8-23" name="__codelineno-8-23"></a><a href="#__codelineno-8-23"><span class="linenos" data-linenos="23 "></span></a>-p <span class="m">0</span>.0.0.0:19000:9000 <span class="se">\</span>
<a id="__codelineno-8-24" name="__codelineno-8-24"></a><a href="#__codelineno-8-24"><span class="linenos" data-linenos="24 "></span></a>-v /opt/cloudera/parcels/CDH/jars/zookeeper-3.4.5-cdh6.3.1.jar:/opt/cmak/lib/org.apache.zookeeper.zookeeper-3.5.7.jar <span class="se">\</span>
<a id="__codelineno-8-25" name="__codelineno-8-25"></a><a href="#__codelineno-8-25"><span class="linenos" data-linenos="25 "></span></a>-v /opt/cloudera/parcels/CDH/jars/zookeeper-3.4.5-cdh6.3.1.jar:/opt/cmak/lib/org.apache.zookeeper.zookeeper-jute-3.5.7.jar <span class="se">\</span>
<a id="__codelineno-8-26" name="__codelineno-8-26"></a><a href="#__codelineno-8-26"><span class="linenos" data-linenos="26 "></span></a>deltaprojects/kafka-manager:v3.0.0.6-2
<a id="__codelineno-8-27" name="__codelineno-8-27"></a><a href="#__codelineno-8-27"><span class="linenos" data-linenos="27 "></span></a>
<a id="__codelineno-8-28" name="__codelineno-8-28"></a><a href="#__codelineno-8-28"><span class="linenos" data-linenos="28 "></span></a><span class="c1"># 或使用克隆镜像</span>
<a id="__codelineno-8-29" name="__codelineno-8-29"></a><a href="#__codelineno-8-29"><span class="linenos" data-linenos="29 "></span></a>registry.cn-shenzhen.aliyuncs.com/wl4g/kafka-manager:v3.0.0.6-2
</code></pre></div>
<blockquote>
<p><strong><em>注：</em></strong> 如果您要连接的 zookeeper server &lt; 3.5.7，则必须按照如上命令示例(这是cdh环境，其他同理)，在运行容器时挂载替换为匹配的版本，否则在 kafka-manager 上 Add Cluster 会报错：<code>KeeperErrorCode = Unimplemented for /kafka-manager/mutex Try again.</code> ，参见官方 issue: <a href="https://github.com/yahoo/CMAK/issues/748">https://github.com/yahoo/CMAK/issues/748</a></p>
</blockquote>

              
            </article>
          </div>
        </div>
        
      </main>
      
        <footer class="md-footer">
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    <script id="__config" type="application/json">{"base": "../../../..", "features": ["search.suggest", "search.highlight", "navigation.tabs", "navigation.expand", "toc.follow", "toc.integrate"], "search": "../../../../assets/javascripts/workers/search.5e67fbfe.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "version": {"default": "latest", "provider": "mike"}}</script>
    
    
      <script src="../../../../assets/javascripts/bundle.c44cc438.min.js"></script>
      
        <script src="../../../../static/js/util.js"></script>
      
    
  </body>
</html>